<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
    Schema::create('companies', function (Blueprint $table) {
      $table->id();
      $table->bigInteger('user_id')->unsigned()->unique();
      $table->string('businessname');
      $table->string('vat');
      $table->boolean('active')->default(true);
      $table->timestamps();
      // Foreign keys constraints
      $table->foreign('user_id')->references('id')->on('users')->onDelete('restrict');
    });
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    Schema::dropIfExists('companies');
  }
};
